const { contextBridge,ipcRenderer } = require('electron')

contextBridge.exposeInMainWorld('versions', {
  node: () => process.versions.node,
  chrome: () => process.versions.chrome,
  electron: () => process.versions.electron
})

contextBridge.exposeInMainWorld('electronAPI', {
  showOpenDialog: (options) => ipcRenderer.invoke('dialog:showOpenDialogSync',options),
  openDirectory: (path) => ipcRenderer.invoke('exec:openDirectory',path),
  getPath: (name) => ipcRenderer.on('app:getPath', name),
  separateTracks:(cmd)=>ipcRenderer.invoke('exec:separateTracks',cmd),
  onSeparateTracksCallback: (callback) => ipcRenderer.on('exec:onSeparateTracksCallback', callback),
  recombineTracks:(cmd)=>ipcRenderer.invoke('exec:recombineTracks',cmd),
  onRecombineTracksCallback: (callback) => ipcRenderer.on('exec:onRecombineTracksCallback', callback),
  deleteTracks:(files)=>ipcRenderer.invoke('exec:deleteTracks',files),
  onDeleteTracksCallback: (callback) => ipcRenderer.on('exec:onDeleteTracksCallback', callback) 
})